<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no" />
    <title>请选择品牌</title>
    @include('index.css')
</head>
<body>
<div id="wrap" class="flexv">
    <header id="header" class="flex header">
        <a href="javascript:window.history.back();" class="flex center bc bc-back icon"></a>
        <div class="flexitem center title">选择品牌</div>
        <a href="javascript:;" class="side save"></a>
    </header>
    <div id="main" class="flexitemv">
        <div class="brands">
        <form action="/" method="get" class="flex search">
            <input type="text" name="q" placeholder="搜索品牌" class="flexitem text" value="{{request()->input('q')}}" />
            <span class="flex center bc bc-search"></span>
            <input type="submit" value="" class="submit" />
        </form>
            {{--<notempty name="result">--}}
                {{--<dl>--}}
                    {{--<dt id="hot">搜索结果</dt>--}}
                    {{--<foreach name="result" item="v">--}}
                        {{--<dd><a href="{:U('index/brand')}?brandId={$v.id}&pid={$Think.get.pid}"><span>{:str_replace($_GET['q'],"<s>".$_GET['q']."</s>",$v['name'])}</span><em>点击进入铃声列表</em><i class="bc bc-right"></i></a></dd>--}}
                    {{--</foreach>--}}
                {{--</dl>--}}
                {{--<else/>--}}
                {{--<div id="none">暂无相关信息~</div>--}}
            {{--</notempty>--}}
        <dl>
        @php
            $keys=array();
            foreach($brands as $key => $brand){
                if(count($brand->card) > 0){
                    if(!in_array(substr($brand->domain,0,1),$keys)){
                        $keys[$key] = substr($brand->domain,0,1);
                        echo '<dt id="'.$keys[$key].'">'.strtoupper($keys[$key]).'</dt>';
                    }
                    echo '<dd><a href="index/brand?brandId='.$brand->id.'&pid='.request()->input("pid").'"><span>'.$brand->name.'</span><em>点击进入名片列表</em><i class="bc bc-right"></i></a></dd>';
                }
            }
        @endphp
        </dl>
    </div>
@if($brands != null)<div class="brand-chars"></div>@endif
<div class="tips" style="text-align:center;padding:10px 30px;font-size:0.9em;color:#f00;">点击顶部标题回到顶部</div>
<a href="https://m.kuaidi100.com/" target="_blank" class="flex center">快递查询</a>
</div>
<div id="onchar">A</div>
</div>
<script href="http://cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/2.2.0/jquery.min.js"></script>
<script href="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script href="{{asset('js/index/functions.js')}}"></script>
<script type="text/javascript">
if($('.brand-chars').size() > 0){
var _hash = window.location.hash;
if(_hash != '' && $(_hash).size() > 0) document.getElementById('main').scrollTop = $(_hash).offset().top - $(_hash).height();

var chars = ('# a b c d e f g h i j k l m n o p q r s t u v w x y z').split(' ');
var str = '';
for(var i = 0;i < chars.length;i ++){
var href = chars[i] == '#' ? '#hot' : '#' + chars[i]
str += '<a href="' + href + '">' + chars[i].toUpperCase() + '</a>';
}
$(str).appendTo($('.brand-chars'));

$('.brand-chars a').click(function (){
var charName = $(this).text().toUpperCase();
$('#onchar').text(charName).addClass('show');
setTimeout(function (){$('#onchar').removeClass('show');},1000);
});

var getRandomColor = function(){
return '#'+('00000'+(Math.random()*0x1000000<<0).toString(16)).slice(-6);
}

$('.hot-box li').each(function (j){
$(this).css('background',getRandomColor());
});
}
$('#header').click(function (){
document.getElementById('main').scrollTop = 0;
});
@if($tips != '')
showAlert('公告','{{$tips.content}}',[{t:'知道了'}]);
@endif
</script>
</body>
</html>